#define _CRT_SECURE_NO_WARNINGS 1
#include "list.h"
namespace jlf 
{
	void test_list1()
	{
		list<int> lt;
		lt.push_back(1);
		lt.push_back(2);
		lt.push_back(3);
		lt.push_back(4);
		lt.push_back(5);
		lt.print_container(lt);
		list<int>::iterator it = lt.begin();
		while (it != lt.end())
		{
			cout << *it << " ";
			it++;
		}
		cout << endl;
	}
	void test_list2()
	{
		list<int> lt1;
		lt1.push_back(1);
		lt1.push_back(2);
		lt1.push_back(3);
		lt1.push_back(4);
		lt1.push_back(5);
		list<int> lt2;
		lt2.push_back(10);
		lt2.push_back(20);
		lt2.push_back(30);
		cout << "lt2:";
		lt2.print_container(lt2);

		
		list<int> lt3 = lt1;
		lt2 = lt3;
		cout << "lt2:";
		lt2.print_container(lt2);
		
		cout << "lt1:";
		lt1.print_container(lt1);
		
		cout << "lt3:";
		lt3.print_container(lt3);
		list<int> lt4(10,5);
		lt4.print_container(lt4);

	}
	void test_list3()
	{
		list<int> lt1;
		lt1.push_back(1);
		lt1.push_back(2);
		lt1.push_back(3);
		lt1.push_back(4);
		lt1.push_back(5);
		cout << "lt1:";
		lt1.print_container(lt1);
		int x = 0;
		cin >> x;
		auto it = lt1.begin();
		while (it != lt1.end())
		{
			if (*it == x)
				break;
			it++;
		}
		
		lt1.insert(it, x);
		cout << "lt1:";
		lt1.print_container(lt1);
		*it *= 100;
		cout << "lt1:";
		lt1.print_container(lt1);

	}
	void test_list4()
	{
		list<int> lt1;
		lt1.push_back(1);
		lt1.push_back(2);
		lt1.push_back(3);
		lt1.push_back(4);
		lt1.push_back(5);
		cout << "lt1:";
		lt1.print_container(lt1);
		auto it = lt1.begin();
		cout << *it << endl;

		it = lt1.erase(it);
		cout << *it << endl;

	}
}
int main()
{
	jlf::test_list2();
	return 0;
}